package com.yiqi.liebang.common.widget;

import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.suozhang.framework.component.recyclerview.DividerItemDecoration;
import com.yiqi.liebang.R;
import com.yiqi.liebang.common.widget.dialog.BaseAnimatorSet;
import com.yiqi.liebang.common.widget.dialog.BasePopup;
import com.yiqi.liebang.common.widget.dialog.BounceTopEnter;

import java.util.List;

public class SimpleCustomPop extends BasePopup<SimpleCustomPop> {
    BaseQuickAdapter.OnItemClickListener wxClickListener;
    RecyclerView mTvItem1;
    PopAdapter popAdapter;
    List<String>  mData;
    public SimpleCustomPop(Context context, List<String>  mData) {
        super(context);
        this.mData=mData;
        mTvItem1.setLayoutManager(new LinearLayoutManager(context));
    }


    @Override
    public View onCreatePopupView() {
        View inflate = View.inflate(mContext, R.layout.popup_custom, null);
        mTvItem1 = inflate.findViewById(R.id.rv_pop);
        return inflate;
    }

    @Override
    public void setUiBeforShow() {

        mTvItem1.addItemDecoration(new DividerItemDecoration(1));
        popAdapter=new PopAdapter();
        popAdapter.bindToRecyclerView(mTvItem1);
        popAdapter.setNewData(mData);
        popAdapter.setOnItemClickListener(wxClickListener);

    }

    public void setWxCircleClickListener(BaseQuickAdapter.OnItemClickListener wxClickListener) {
        this.wxClickListener = wxClickListener;
    }


    private class PopAdapter extends BaseQuickAdapter<String ,BaseViewHolder>{

        public PopAdapter() {
            super(R.layout.pop_user_info);
        }

        @Override
        protected void convert(BaseViewHolder helper, String item) {
           helper.setText(R.id.tv_pop,item);
        }
    }
}